//
// Created by hugan on 2020/11/16.
//

#include "BatteryUtil.h"

int BatteryUtil::isAcOnline() {
    SYSTEM_POWER_STATUS sysPower = {0};
    GetSystemPowerStatus(&sysPower);
    return sysPower.ACLineStatus;
}

int BatteryUtil::getBatteryValue() {
    SYSTEM_POWER_STATUS sysPower = {0};
    GetSystemPowerStatus(&sysPower);
    return (int) sysPower.BatteryLifePercent;
}
